package com.finger.hospservice.controller;

import com.finger.hospservice.service.ScheduleService;
import com.finger.modelservice.model.hosp.Schedule;
import com.finger.modelservice.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(value = "/admin/hosp/schedule")
//@CrossOrigin
public class ScheduleController {

    @Autowired
    private ScheduleService scheduleService;

    @GetMapping(value = "findScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result findScheduleRule(@PathVariable Integer page,
                                   @PathVariable Integer limit,
                                   @PathVariable String hoscode,
                                   @PathVariable String depcode){
        Map<String,Object> resultMap = scheduleService.findScheduleRule(page,limit,hoscode,depcode);
        return Result.ok(resultMap);
    }

    @GetMapping(value = "findScheduleDetails/{hoscode}/{depcode}/{workDate}")
    public Result findScheduleDetails(@PathVariable String hoscode,
                                      @PathVariable String depcode,
                                      @PathVariable String workDate){
        List<Schedule> list = scheduleService.findScheduleDetails(hoscode,depcode,workDate);

        return Result.ok(list);

    }
}
